package so.wy.servicecenter.businessbed.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import so.wy.servicecenter.base.frame.api.AbstractHttp;
import so.wy.servicecenter.base.frame.api.httpexception.HttpExceptionHandler;
import so.wy.servicecenter.businessbed.web.BedStaticsWeb;

@RestController
@Scope("request")
@RequestMapping("/statics")
public class BedStaticsHttp extends AbstractHttp {
    @Autowired
    private BedStaticsWeb staticsWeb;

    //1、总订单量
    //2、总订单金额，总实际支付金额，总免单金额
    //3、当前押金池金额 当前总充值用户数
    //4、总床数量 总投放床数量
    @HttpExceptionHandler
    @GetMapping("/total")
    public String getTotalStatics() {
        return toHttpJson(staticsWeb.getTotalStatics());
    }

    //医院总信息
    @HttpExceptionHandler
    @GetMapping("/total/hospital/list")
    public String getTotalHospitalInfo() {
        return toHttpJson(staticsWeb.getTotalHospitalInfo());
    }

    //最近一个月总订单量变化趋势
    @HttpExceptionHandler
    @GetMapping("/total/line/order")
    public String totalDayOrderCountLineLastMonth() {
        return toHttpJson(staticsWeb.totalDayOrderCountLineLastMonth());
    }

    //7、充值用户变化趋势
    @HttpExceptionHandler
    @GetMapping("/total/line/user")
    public String totalCzUserCountLine() {
        return toHttpJson(staticsWeb.totalCzUserCountLine());
    }

    //统计当天的一些信息
    @HttpExceptionHandler
    @GetMapping("/today")
    public String getTodayInfo() {
        return toHttpJson(staticsWeb.getTodayInfo());
    }

    //4、医院当日订单信息（总订单量，订单金额，实际支付金额）
    @HttpExceptionHandler
    @GetMapping("/today/hospital")
    public String todayOrderInfoGroupHospital() {
        return toHttpJson(staticsWeb.todayOrderInfoGroupHospital());
    }

    //医院维度
    @HttpExceptionHandler
    @GetMapping("/hospital/total")
    public String getTotalHospitalStatics(Long hospitalId){
        return toHttpJson(staticsWeb.getTotalHospitalStatics(hospitalId));
    }

    @HttpExceptionHandler
    @GetMapping("/hospital/today")
    public String getTodayHospitalInfo(Long hospitalId){
        return toHttpJson(staticsWeb.getTodayHospitalInfo(hospitalId));
    }

    //2、各楼层 投放床数量 总订单量
    @HttpExceptionHandler
    @GetMapping("/hospital/floor")
    public String getTotalFloorInfo(Long hospitalId) {
        return toHttpJson(staticsWeb.getTotalFloorInfo(hospitalId));
    }

    //3、各科室 投放床数量 总订单量
    @HttpExceptionHandler
    @GetMapping("/hospital/depart")
    public String getTotalDepartInfo(Long hospitalId) {
        return toHttpJson(staticsWeb.getTotalDepartInfo(hospitalId));
    }

    @HttpExceptionHandler
    @GetMapping("/hospital/order/line")
    public String totalDayHospitalOrderCountLineLastMonth(Long hospitalId) {
        return toHttpJson(staticsWeb.totalDayHospitalOrderCountLineLastMonth(hospitalId));
    }

    //4、各楼层 订单量变化趋势
    @HttpExceptionHandler
    @GetMapping("/hospital/floor/line")
    public String totalDayOrderCountLineLastMonthGroupFloor(Long floorId) {
        return toHttpJson(staticsWeb.totalDayOrderCountLineLastMonthGroupFloor(floorId));
    }

    //5、各科室 订单量变化趋势
    @HttpExceptionHandler
    @GetMapping("/hospital/depart/line")
    public String totalDayOrderCountLineLastMonthGroupDepart(Long departId) {
        return toHttpJson(staticsWeb.totalDayOrderCountLineLastMonthGroupDepart(departId));
    }

}
